#include <stdlib.h>
#include <iostream>
#include <string.h>
#include <stdio.h>


//3 malloc + 1 calloc + 1 realloc + 4 free
void malloc_free_calloc(){
    void* d =malloc(45);
    void* p =malloc(487);
	    
    void* c =calloc(44,10);
    void* x =calloc(12,10);
    
    d=realloc(d,48);
    //d=realloc(d,48);
    free(c);
    free(d);
    free(p);
    free(x);
    
    double * dd=new double[100];
    delete dd;
}


int main(int argc,char** argv)
{
  if(argc!=2){
   printf("Usage:./prog [steps:int]\n");
   return 0 ;
  }
  int steps = atoi(argv[1]);
  for(int i=0;i<steps;i++){
      malloc_free_calloc();
  }
  
  
    return 0;
}
